#!/bin/bash
#
#
COMPRESS_PATH=~/BelRusProjetcts/libs/compress

echo "compress *.js and *.css"

#----------------MooTools---------------------
#
#cat ./mootools-core-1.4.5-full-nocompat.js ./mootools-more-1.4.0.1.js  > mootools.js
#/usr/bin/java -classpath $COMPRESS_PATH/rhino-1.6R7.jar \
#              -classpath $COMPRESS_PATH/jargs-1.0.jar \
#              -jar $COMPRESS_PATH/yuicompressor-2.4.2.jar \
#              -o ../../js/mootools.js ./mootools.js

#cp ./mootools.js ../../js/mootools.js
#rm ./mootools.js
#echo "mootools.js Done"

#----------------WebStat---------------------
# js webstat & picker
cat ./webstat/webstat.js ./webstat/calendar.js ./webstat/customers.js ./webstat/google.js ./webstat/orders.js \
    ./webstat/pager.js ./webstat/resellers.js ./webstat/showorder.js ./webstat/suggest.js ./webstat/webstatus.js \
    ./webstat/showbox.js ./webstat/epyVendor.js ./webstat/epyGroups.js ./webstat/epyUser.js ./webstat/epyItemTest.js \
    ./webstat/epyUpdate.js ./webstat/MakeCoupon.js ./webstat/ItemTracking.js ./webstat/users.js \
    ./webstat/googleFeed.js ./webstat/categoryMenu.js ./webstat/login.js ./webstat/tabs.js ./webstat/modalBox.js ./webstat/itemsOnGoogle.js \
    ./datepicker/datepicker.js ./webstat/toolbar.js ./webstat/loader.js > ./webstat/temp.js

/usr/bin/java -classpath $COMPRESS_PATH/rhino-1.6R7.jar \
              -classpath $COMPRESS_PATH/jargs-1.0.jar \
              -jar $COMPRESS_PATH/yuicompressor-2.4.2.jar \
              -o ../../js/webstat.js ./webstat/temp.js

#cp ./webstat/temp.js ../../js/webstat.js
rm ./webstat/temp.js
echo "webstat.js Done"

#----------------Tree---------------------
#./tree/mootools.js
cat ./tree/CV.Tree.js ./tree/CV.Tree.Node.js ./tree/CV.Tree.Hover.js ./tree/CV.Tree.Selection.js \
    ./tree/CV.Tree.Load.js ./tree/CV.Tree.Draw.js ./tree/CV.Tree.Drag.js ./tree/CV.Tree.Drag.Element.js \
    ./tree/CV.Tree.Rename.js ./tree/CV.Tree.Transform.js ./tree/CV.Tree.Sort.js ./tree/CV.Tree.Checkbox.js \
    ./tree/CV.ContextMenu.js ./tree/CV.Tree.QuickToolbar.js ./tree/CV.Tree.Json.js > ./tree/temp.js

/usr/bin/java -classpath $COMPRESS_PATH/rhino-1.6R7.jar \
              -classpath $COMPRESS_PATH/jargs-1.0.jar \
              -jar $COMPRESS_PATH/yuicompressor-2.4.2.jar \
              -o ../../tree/tree.js ./tree/temp.js

#cp ./tree/temp.js ../../tree/tree.js
rm ./tree/temp.js
echo "tree.js Done"


# css webstat & picker
cat ./webstat/webstat.css ./datepicker/css/dashboard.css > ./webstat/temp.css

/usr/bin/java -classpath $COMPRESS_PATH/rhino-1.6R7.jar \
              -classpath $COMPRESS_PATH/jargs-1.0.jar \
              -jar $COMPRESS_PATH/yuicompressor-2.4.2.jar \
              -o ../../css/webstat.css ./webstat/temp.css

rm ./webstat/temp.css
echo "webstat.css Done"

#----------------Datepicker---------------------
# images Datepicker
cp ./datepicker/img/* ../../img/picker/
echo "*.img Datepicker Done"

exit 0
